﻿<!doctype html>
<html>
	<head>
		<title>羽乐汇</title>
		<meta name="keywords" content="羽毛球，球会，球场，教练">
		<meta name="charset" content="UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1" />
		<link rel="stylesheet" type="text/css" href="__PUBLIC__/CSS/HomePage/bootstrap.min.css">
		<!-- <link rel="stylesheet" type="text/css" href="__PUBLIC__/CSS/HomePage/wap_index.css"> -->
		<link rel="stylesheet" type="text/css" href="__PUBLIC__/CSS/HomePage/index.css">
		
		<script type="text/javascript" src="__PUBLIC__/JS/HomePage/jquery.min.js"></script>
		<script type="text/javascript" src="__PUBLIC__/JS/layer-v2.1/layer/layer.js"></script>
		<script type="text/javascript" src="__PUBLIC__/JS/HomePage/bootstrap.min.js"></script>
		<script type="text/javascript" src="__PUBLIC__/JS/HomePage/md5.js"></script>
		<script type="text/javascript" src="__PUBLIC__/JS/query-object.js"></script>
		<script type="text/javascript" src="__PUBLIC__/JS/HomePage/yuleclub.js"></script>
    </head>
	<body>
	<!-- ---------------------------------------------------------------pc_index--------------------------------------------------------- -->
		<div class="pc_coach container-fluid">
			<div class="top visible-lg visible-md">
				<div class="ttop">
					<span>欢迎来到羽乐汇</span>
					<div>
						<span class="wellcome"></span>
						<span class="login">
							<a href="<{:U('Login/userlogin')}>">登陆</a>
							<!-- <button class="notlogin_btn">注销</button> -->
							<a href="<{:U('Index/registration')}>">注册</a>
							
						</span>
						<!-- <button class="sign_btn">注册</button> -->
						<a class="login_after" href="<{:U('User/index')}>">个人主页</a>
						<a href="__PUBLIC__/HTML/vip_center.html">vip中心</a>
					</div>
				</div>
				<div>
					<img src="__PUBLIC__/PICTURE/HomePage/logo.jpg">
				</div>
				<div class="main_nav">
					<ul>
						<li><a href="<{:U('Index/index')}>">首页</a></li>
						<li><a href="<{:U('Gymnasium/index')}>">球场</a></li>
						<li><a href="<{:U('Club/index')}>">球会</a></li>
						<li>培训</li>
						<li><a href="<{:U('Activity/activity',array('activity_type'=>0))}>">活动</a></li>
						<li><a href="<{:U('Coach/index')}>">教练</a></li>
						<li><a href="<{:U('Competition/index')}>">竞赛</a></li>
						<li><a href="<{:U('Announce/index')}>">公告</a></li>
					</ul>
				</div>
			</div>
			<header class="row visible-xs visible-sm header_nav">
				<a id="nav_a" href="<{:U('Index/index')}>"><img src="__PUBLIC__/PICTURE/HomePage/pre.png"/></a>
				<span>竞赛页面</span>
			</header>
			<div class="search_content">
				<div class="top_search">
					<form action=" " name="search_form" method="post" >
						<select name="search_type" class="ui-select search_type f_l">
							<option value="1" {if $search_type eq 1}selected="selected"{/if}>搜竞赛</option>
						</select>
						<input type="text" name="search_keyword" class="search_keyword" holder="请输入您要搜索的关键词"/>
						<input class="search_btn" rel="search_btn" type="button" value="搜索"/>
					</form>
				</div>
			</div>
			<div class="introduce_contest">
				<div class="contest_about">
					<div class="img_div"><img src="" alt="头像"></div>
					<div class="content">
						<span>球赛介绍：</span><br/>
						<div><p>羽乐是一款便于羽毛球兴趣协会（球会）组织工作的工具软件为切入，聚合球会会员社交，球场O2O等多项功能的app软件。提供会员创建球会，组织活动，活动报名，活动积分，资料共享，会员聊天，球场订场，教练培训等多项功能，是羽毛球爱好者、球场经营者，羽球教练深度使用的应用软件</p></div>
<!-- 						<span>主办方简介:</span><br/>
						<div><p>羽乐是一款便于羽毛球兴趣协会（球会）组织工作的工具软件为切入，聚合球会会员社交，球场O2O等多项功能的app软件。提供会员创建球会，组织活动，活动报名，活动积分，资料共享，会员聊天，球场订场，教练培训等多项功能，是羽毛球爱好者、球场经营者，羽球教练深度使用的应用软件</p></div> -->
					</div>
				</div>
			</div>
			<div class="contest_content">
				<div class="contest_nav">
				定位信息<span id="baidu_geo"></span><button id="local">查看本地球场</button>
<!-- 					<ul class="row list-unstyled nav1 container">
						<li class="col-lg-1 col-md-1">
							<div class="form-group">
								<select class="form-control select1">
	         						<option value="">广东省</option>
	         						<option value="">山东省</option>
	         						<option value="">福建省</option>
	         						<option value="">陕西省</option>
	      						</select>
							</div>
						</li>
						<li class="col-lg-1 col-md-1">
							<div class="form-group">
								<select class="form-control select2">
	         						<option value="">广东市</option>
	         						<option value="">佛山市</option>
	         						<option value="">珠海市</option>
	         						<option value="">清远市</option>
	      						</select>
							</div>
						</li>
						<li class="col-lg-1 col-md-1">
							<div class="form-group">
								<select class="form-control">
	         						<option value="">番禺区</option>
	         						<option value="">海珠区</option>
	         						<option value="">天河区</option>
	         						<option value="">花都区</option>
	      						</select>
							</div>					
						</li>
						<li class="col-lg-1 col-md-1">
							<div class="form-group">
								<select class="form-control">
	         						<option value="">大学城</option>
	         						<option value="">官洲</option>
	         						<option value="">小洲村</option>
	         						<option value="">万胜围</option>
	      						</select>
							</div>								
						</li>
					</ul> -->
				</div>
				
				<div class="contest_messege" id="contest">
					<{:W('Competition/Index',array('count'=>1))}>
				</div>
				<div class="contest_messege" id="which_contest">
				<{:W('Competition/Index',array('count'=>2))}>
				</div>
			</div>
			</div>
			<div class="foot row">
				<div>
					<p>联系我们</p>
					<p>关于我们</p>
					<p>加入我们</p>
				</div>
				<div>
					<p>电话：400-800-8888 周一至周六9：00-18：00</p>
					<p>[羽乐汇]<a href="http://oto.my3w.com">http://oto.my3w.com</a></p>
				</div>
			</div>
		<script type="text/javascript">
			var province; //省名
			var city ;  //城市名
			var district;   //区县名
			var which_id="";
			var search_name;	
			// var competition_province;
			// var competition_city;		
			var total_page;
			var page_num=1;
			var competition_count;
			var old_value="";//select2的选择
			var competitionResult; //详细页面的
			var gymnasiumResult;//详细页面的
			var result;
			// 初始化页面
			$(function(){
				// getLocation();
				// alert(getCookie("privice"));
				// layer.msg(getCookie("mzz"));
				var competition_name;
				var com_model_item;
				var competition_begin_time;
				var competition_contain_number;
				var competition_id;
				var competition_picture;
				var competition_publish_time;
				var competition_regist_unit;
				var competition_status;
				// competition_province=$('.select1 option:selected').text();
				// competition_city=$('.select2 option:selected').text();
				// old_value=competition_city;
				page_num=1;
				$.post('__URL__/listCompetitionByTime',{'page_num':page_num,'competition_province':province,'competition_city':city},function(resultList){
					page_num=resultList.page_num;
					competition_count=resultList.competition_count;
					initpage_num(competition_count);
					result=resultList.result;
					console.log(competition_count);
					$('#contest').css({display:"block"});
					console.log(result);
					competition_main(com_model_item,competition_begin_time,competition_contain_number,competition_id,competition_name,competition_picture,competition_publish_time,competition_regist_unit,competition_status,result);
					$('.atttend_match').bind('click',competition_id,function(){
						which_id=$(this).attr("id");
						atttend_match(which_id);
					});
	    		},'json');
	    		
			});
			//根据搜索显示
			$('.pc_coach').delegate('.search_btn','click',function(){
				var competition_name=$('.top_search .search_keyword').val();
				var com_model_item;
				var competition_begin_time;
				var competition_contain_number;
				var competition_id;
				var competition_picture;
				var competition_publish_time;
				var competition_regist_unit;
				var competition_status;
				search_name=competition_name;
				page_num=1;
				$.post('__URL__/competitionSearch',{'competition_name':competition_name,'page_num':page_num},function(resultList){
						console.log(resultList);
						page_num=resultList.page_num;
						competition_count=resultList.competition_count;
						initpage_num(competition_count);
						result=resultList.result;
						console.log(result);					
						$('#contest').css({display:"block"});
						$('.pageup').attr("id","pageup_serach");
						$('.pagedown').attr("id","pagedown_serach");
						competition_main(com_model_item,competition_begin_time,competition_contain_number,competition_id,competition_name,competition_picture,competition_publish_time,competition_regist_unit,competition_status,result);
						$('.atttend_match').bind('click',competition_id,function(){
							which_id=$(this).attr("id");
							atttend_match(which_id);
						});

	    		},'json');
			});
			//根据地理位置显示
			// $('.select2').bind('click',function(event){				
			// 	var now_value=$('.select2 option:selected').text();
			// 	var com_model_item;
			// 	var competition_begin_time;
			// 	var competition_contain_number;
			// 	var competition_id;
			// 	var competition_name;
			// 	var competition_picture;
			// 	var competition_publish_time;
			// 	var competition_regist_unit;
			// 	var competition_status;
			// 	page_num=1;
			// 	if(old_value!=now_value){
			// 		old_value=now_value;
			// 		competition_province=$('.select1 option:selected').text();
			// 		competition_city=$('.select2 option:selected').text();
			// 		console.log(competition_city);
			// 		$.post('__URL__/listCompetitionByTime',{'page_num':page_num,'competition_province':competition_province,'competition_city':competition_city},function(resultList){
			// 			page_num=resultList.page_num;
			// 			competition_count=resultList.competition_count;
			// 			initpage_num(competition_count);
			// 			result=resultList.result;
			// 			// if(competition_count%5==0){
			// 			// 	total_page=parseInt(competition_count/5);
			// 			// }
			// 			// else{
			// 			// 	total_page=parseInt(competition_count/5)+1;
			// 			// }						
			// 			console.log(result);
			// 			$('#contest').css({display:"block"});
			// 			competition_main(com_model_item,competition_begin_time,competition_contain_number,competition_id,competition_name,competition_picture,competition_publish_time,competition_regist_unit,competition_status,result);
			// 			$('.atttend_match').bind('click',competition_id,function(){
			// 				which_id=$(this).attr("id");
			// 				atttend_match(which_id);
			// 			});
	  //   			},'json');
			// 	}
				
			// });
			//点击进入详细页面
			$(".contest_messege").delegate(".know_more","click",function(){
				var competition_id=$(this).attr('name');
				$(".contest_nav").css({display:"none"});
				$('.search_content').css({display:"none"});
				$(".introduce_contest").css({display:"block"});
				$("#contest").css({display:"none"});
				$("#which_contest").css({display:"block"});
				$('.header_nav a').attr("href","<{:U('Competition/index')}>");
				$('.header_nav span').html('竞赛详情页面');
				$.post('__URL__/competitionInfo',{'competition_id':competition_id},function(resultList){
						competitionResult=resultList.competitionResult;
						gymnasiumResult=resultList.gymnasiumResult;
						result=resultList.userResult;
						console.log(result);
						competition_detail();
						$('.atttend_match').bind('click',competition_id,function(){
							which_id=$(this).attr("id");
							atttend_match(which_id);
						});
	    		},'json');
	    		
			});
			function competition_main(com_model_item,competition_begin_time,competition_contain_number,competition_id,competition_name,competition_picture,competition_publish_time,competition_regist_unit,competition_status,result){
				console.log(result);
				var length_result=result.length;
				switch(length_result){
					case 1:
						$(".contest_list1,.contest_list2,.contest_list3,.contest_list4").css({display:"none"});
						break;
					case 2:
						$(".contest_list2,.contest_list3,.contest_list4").css({display:"none"});
						break;
					case 3:
						$(".contest_list3,.contest_list4").css({display:"none"});
						break;
					case 4:
						$(".contest_list4").css({display:"none"});
						break;
					default:
						$(".contest_list1,.contest_list2,.contest_list3,.contest_list4").css({display:"inline-block"});
						break;
				}
				$.each(result,function(i,item_X){
					// console.log(item_X);
					com_model_item=item_X["com_model_item"];
					// console.log(com_model_item);
					var contest_type="单项赛";
					var contests=new Array();
					switch(com_model_item){
						case "1":
							contest_type="单项赛";
							contests.push("男单");
							break;
						case "2":
							contest_type="单项赛";
							contests.push("女单");
							break;
						case "3":
							contest_type="单项赛";
							contests.push("男双");
							break;
						case "4":
							contest_type="单项赛";
							contests.push("男单");
							break;
						case "5":
							contest_type="单项赛";
							contests.push("女双");
							break;
						case "6":
							contest_type="三体团体赛";
							contests.push("男双");
							contests.push("女双");
							contests.push("混双");
							break;
						case "7":
							contest_type="三体团体赛";
							contests.push("男双");
							contests.push("混双");
							contests.push("老年组");							
							break;
						case "8":
							contest_type="三体团体赛";
							contests.push("男双");
							contests.push("混双");
							contests.push("男单");							
							break;
						default:
							break;

					}
					competition_begin_time=item_X["competition_begin_time"];
					competition_contain_number=item_X["competition_contain_number"];
					competition_id=item_X["competition_id"];
					competition_name=item_X["competition_name"];
					competition_picture=item_X["competition_picture"];
					competition_publish_time=item_X["competition_publish_time"];
					competition_regist_unit=item_X["competition_regist_unit"];
					competition_status=item_X["competition_status"];
					// 将获取的数据显示在页面---------
					
					var contest_list="<ul><li><span>竞赛名称：</span>";
					contest_list +=competition_name;
					contest_list +="</li><li><span>报名时间：</span>";
					contest_list +=competition_publish_time;
					contest_list +="</li><li><span>比赛时间：</span>";
					contest_list +=competition_begin_time;
					contest_list +="</li><li><span>竞赛类型：</span>";
					contest_list +=contest_type;
					contest_list +="</li><li><span>报名项目：</span><select class=\"form-control\">";
					$.each(contests,function(j,item){
						contest_list +="<option>"+item+"</option>";
					});
					contest_list +="</select></li>";
					contest_list +="<li><button class=\"atttend_match\" id=\"";
					contest_list +=competition_id+"\">我要报名</button><input type=\"button\" class=\"know_more\" name=\"";
					contest_list += competition_id+"\" value=\"点击了解详情\"\/></li></ul>";
					// console.log(contests);
					// console.log(contest_list);
					console.log(contest_div);
					var contest_list_class=".contest_list"+i;
					var contest_div=$(contest_list_class);
					contest_div.html(contest_list);
				});
			}
			function competition_detail(){
				var competition_name;
				var com_model_item;
				var competition_begin_time;
				var competition_publish_time;
				var competition_picture;
				var competition_content;
				// console.log(competitionResult);
				com_model_item=competitionResult["com_model_item"];
				var contest_type="单项赛";
				var contests=new Array();
				switch(com_model_item){
					case "1":
						contest_type="单项赛";
						contests.push("男单");
						break;
					case "2":
						contest_type="单项赛";
						contests.push("女单");
						break;
					case "3":
						contest_type="单项赛";
						contests.push("男双");
						break;
					case "4":
						contest_type="单项赛";
						contests.push("男单");
						break;
					case "5":
						contest_type="单项赛";
						contests.push("女双");
						break;
					case "6":
						contest_type="三体团体赛";
						contests.push("男双");
						contests.push("女双");
						contests.push("混双");
						break;
					case "7":
						contest_type="三体团体赛";
						contests.push("男双");
						contests.push("混双");
						contests.push("老年组");							
						break;
					case "8":
						contest_type="三体团体赛";
						contests.push("男双");
						contests.push("混双");
						contests.push("男单");							
						break;
					default:
						break;

				}
				competition_begin_time=competitionResult["competition_begin_time"];
				competition_publish_time=competitionResult["competition_publish_time"];
				competition_name=competitionResult["competition_name"];
				competition_content=competitionResult["competition_content"];
				competition_picture=competitionResult["competition_picture"];
				$('.img_div img').attr('src',competition_picture);
				var introduce_body="<span>球赛介绍：</span><br/><div><p>";
				introduce_body+=competition_content;
				introduce_body+="</p></div>";
				$('.introduce_contest .content').html(introduce_body);
				var contest_detail="<ul><li><span>竞赛名称：</span>"+competition_name+"</li><li><span>报名时间：</span>";
				contest_detail+=competition_publish_time;
				contest_detail+="</li><li><span>比赛时间：</span>";
				contest_detail+=competition_begin_time;
				contest_detail+="</li><li><span>竞赛类型:</span>";
				contest_detail+=contest_type;
				contest_detail+="</li><li><span>报名项目:</span><select> class=\"form-control\">";
				$.each(contests,function(i,item){
					contest_detail +="<option>"+item+"</option>";
				});
				contest_detail +="</select></li>";
				contest_detail +="<li><button class=\"atttend_match\" id=\"";
				contest_detail +=which_id+"\">我要报名</button></li></ul>";
				// </li><li><button class=\"atttend_match\">我要报名</button></li></ul>";
				var contest_div=$('.contest_detail');
				contest_div.html(contest_detail);
			}

			// 报名参加

			function atttend_match(competition_id){
				// console.log(getCookie('PHPSESSID'));
				console.log(getCookie('username'));
				var user_name=getCookie('username');
				if(user_name!=""){
					console.log(competition_id);
					$.post('__URL__/competitionApply',{'competition_id':competition_id},function(result){
							switch(result){
								case 0:
									layer.msg('已截至报名');
									break;
								case 1:
									layer.msg('报名成功');
									break;
								case 2:
									layer.msg('已经报过名了');
									break;
								default:
									break;
							}
		    		},'json');
				}else{
					layer.msg('请先登录');
				}
			}
			$('.pageup').bind('click',function(){
				// var competition_province;
				// var competition_city;	
				var com_model_item;
				var competition_begin_time;
				var competition_contain_number;
				var competition_id;
				var competition_picture;
				var competition_publish_time;
				var competition_regist_unit;
				var competition_status;
				var competition_name; 
				var is_search;
				// competition_province=$('.select1 option:selected').text();
				// competition_city=$('.select2 option:selected').text();

				page_num--;
				$('.page').html(page_num);
				if(page_num == 1){
					$('.pageup').css({display:"none"});
				}
				$('.pagedown').css({display:"inline"});
				is_search=$(this).attr("id");
				if(is_search=="pageup"){
					$.post('__URL__/listCompetitionByTime',{'page_num':page_num,'competition_province':province,'competition_city':city},function(resultList){
						page_num=resultList.page_num;
						competition_count=resultList.competition_count;
						// console.log(result);
						result=resultList.result;
						// if(competition_count%5==0){
						// 	total_page= parseInt(competition_count/5);
						// }
						// else{
						// 	total_page=parseInt(competition_count/5)+1;
						// }		
						// console.log(result);
						$('#contest').css({display:"block"});
						competition_main(com_model_item,competition_begin_time,competition_contain_number,competition_id,competition_name,competition_picture,competition_publish_time,competition_regist_unit,competition_status,result);
						$('.atttend_match').bind('click',competition_id,function(){
							which_id=$(this).attr("id");
							atttend_match(which_id);
						});
	    			},'json');
				}else{
					$.post('__URL__/competitionSearch',{'page_num':page_num,'competition_name':search_name},function(resultList){
						page_num=resultList.page_num;
						competition_count=resultList.competition_count;
						// console.log(result);
						result=resultList.result;
						// if(competition_count%5==0){
						// 	total_page= parseInt(competition_count/5);
						// }
						// else{
						// 	total_page=parseInt(competition_count/5)+1;
						// }		
						// console.log(result);
						$('#contest').css({display:"block"});
						competition_main(com_model_item,competition_begin_time,competition_contain_number,competition_id,competition_name,competition_picture,competition_publish_time,competition_regist_unit,competition_status,result);
						$('.atttend_match').bind('click',competition_id,function(){
							which_id=$(this).attr("id");
							atttend_match(which_id);
						});
	    			},'json');
				}
			});
			$('.pagedown').bind('click',function(){
				// var competition_province;
				// var competition_city;
				var com_model_item;
				var competition_begin_time;
				var competition_contain_number;
				var competition_id;
				var competition_picture;
				var competition_publish_time;
				var competition_regist_unit;
				var competition_status;
				var competition_name; 
				var is_search;
				// competition_province=$('.select1 option:selected').text();
				// competition_city=$('.select2 option:selected').text();
				page_num++;
				$('.page').html(page_num);
				// console.log(page_num);
				// console.log(total_page);
				if(page_num == total_page){
					$('.pagedown').css({display:"none"});
				}
				$('.pageup').css({display:"inline"});
				is_search=$(this).attr("id");
				if(is_search=="pagedown"){
					$.post('__URL__/listCompetitionByTime',{'page_num':page_num,'competition_province':province,'competition_city':city},function(resultList){
						page_num=resultList.page_num;
						competition_count=resultList.competition_count;
						// console.log(competition_count);
						result=resultList.result;
						// if(competition_count%5==0){
						// 	total_page= parseInt(competition_count/5);
						// }
						// else{
						// 	total_page=parseInt(competition_count/5)+1;
						// }		
						// console.log(result);
						$('#contest').css({display:"block"});
						competition_main(com_model_item,competition_begin_time,competition_contain_number,competition_id,competition_name,competition_picture,competition_publish_time,competition_regist_unit,competition_status,result);
						$('.atttend_match').bind('click',competition_id,function(){
							which_id=$(this).attr("id");
							atttend_match(which_id);
						});
	    			},'json');
				}else{
					$.post('__URL__/competitionSearch',{'page_num':page_num,'competition_name':search_name},function(resultList){
						page_num=resultList.page_num;
						competition_count=resultList.competition_count;
						// console.log(competition_count);
						result=resultList.result;
						// if(competition_count%5==0){
						// 	total_page= parseInt(competition_count/5);
						// }
						// else{
						// 	total_page=parseInt(competition_count/5)+1;
						// }		
						// console.log(result);
						$('#contest').css({display:"block"});
						competition_main(com_model_item,competition_begin_time,competition_contain_number,competition_id,competition_name,competition_picture,competition_publish_time,competition_regist_unit,competition_status,result);
						$('.atttend_match').bind('click',competition_id,function(){
							which_id=$(this).attr("id");
							atttend_match(which_id);
						});
	    			},'json');
				}
			});
			function initpage_num($date){
				$('.top_search .search_keyword').val("");
				$('.page').html("1");
				if($date%5==0){
					total_page= parseInt($date/5);
				}
				else{
					total_page=parseInt($date/5)+1;
				}
				if(page_num == 1){
					$('.pageup').css({display:"none"});
				}else{
					$('.pageup').css({display:"inline"});
				}
				if(page_num == total_page){
					$('.pagedown').css({display:"none"});
				}else{
					$('.pagedown').css({display:"inline"});
				}
			}
<!----------调用百度API返回位置信息------------>
		function getLocation(){
			if (navigator.geolocation){
				navigator.geolocation.getCurrentPosition(showPosition,showError);
			}else{
		alert("浏览器不支持地理定位。");
			}
		}
		function showPosition(position){ 
    	var latlon = position.coords.latitude+','+position.coords.longitude; 
     
    	//baidu 
    		var url = "http://api.map.baidu.com/geocoder/v2/?ak=C93b5178d7a8ebdb830b9b557abce78b&callback=renderReverse&location="+latlon+"&output=json&pois=0"; 
   		 $.ajax({  
       		 type: "GET",  
       		 dataType: "jsonp",  
       		 url: url, 
      		  beforeSend: function(){ 
         		   $("#baidu_geo").html('正在定位...'); 
       		 }, 
        		success: function (json) {  
          		  if(json.status==0){ 
          		      $("#baidu_geo").html(json.result.addressComponent.city); 
          		      province=json.result.addressComponent.province;
          		      city=json.result.addressComponent.city;
          		      district=json.result.addressComponent.district;
          		  } 
      		  }, 
       		 error: function (XMLHttpRequest, textStatus, errorThrown) {  
       		     $("#baidu_geo").html(latlon+"地址位置获取失败");  
       		 } 
   		 }); 
		} 
		function showError(error){
			switch(error.code) {
				case error.PERMISSION_DENIED:
					alert("定位失败,用户拒绝请求地理定位");
					break;
				case error.POSITION_UNAVAILABLE:
					alert("定位失败,位置信息是不可用");
					break;
				case error.TIMEOUT:
					alert("定位失败,请求获取用户位置超时");
					break;
				case error.UNKNOWN_ERROR:
					alert("定位失败,定位系统失效");
					break;
 		   }
		}

		getLocation();
		$('#local').click(function () { 
				// alert(page_num);
				page_num=1;
				$.post('__URL__/listCompetitionByTime',{'page_num':page_num,'competition_province':province,'competition_city':city},function(resultList){
					page_num=resultList.page_num;
					competition_count=resultList.competition_count;
					initpage_num(competition_count);
					result=resultList.result;
					console.log(competition_count);
					$('#contest').css({display:"block"});
					console.log(result);
					competition_main(com_model_item,competition_begin_time,competition_contain_number,competition_id,competition_name,competition_picture,competition_publish_time,competition_regist_unit,competition_status,result);
					$('.atttend_match').bind('click',competition_id,function(){
						which_id=$(this).attr("id");
						atttend_match(which_id);
					});
	    		},'json');
		}); 
		</script>
	</body>
</html>